package com.controller;

import com.bean.Msg;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

/**处理异常的jwt认证的Msg返回
 * @author WxrStart
 * @create 2022-05-26 14:20
 */
@RestController
public class FilterErrorController {
    @ResponseBody
    @RequestMapping("/filterError/{code}/{message}")
    public Msg error(@PathVariable("code")Integer code, @PathVariable("message")String message){
        if("noRole".equals(message)){
            message="该用户没有权限访问后台";
        }
        Msg fail = Msg.fail();
        fail.setCode(code);
        fail.add("result",message);
        return fail;
    }
}